<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="js/react.js"></script>
    <script src="js/react-dom.js"></script>
    <script src="js/browser.min.js"></script>
</head>
<body>
    <div id='example'></div>

    <script type='text/babel'>
        var MyHeader = React.createClass({
            render:function(){
                return <h2>这是页头组件</h2>
            }
        });
        
        var MyCart = React.createClass({
            render:function(){
                return <div>
                    <MyHeader></MyHeader>
                    <ul>
                        <li>商品1</li>
                        <li>商品2</li>
                        <li>商品3</li>
                    </ul>    
                </div>
            }
        });
        
        //render方法在此是用来指定应用程序的根组件
        ReactDOM.render(
            <MyCart></MyCart>,
            document.getElementById('example')
        );
    </script>
</body>
</html>